package com.study.spark.scala.chapter05

object Scala05_Function_Hell_5 {
  def main(args: Array[String]): Unit = {
    // TODO 函数式编程
    // 函数作为返回值返回
    def test(): Unit ={
      println("function....")
    }

    def fun()/*: () => Unit可有可无？？？可以推断出返回值类型为函数类型所以可以省略*/ ={
      test _
    }

    val f = fun _
    val ff = f()
    println("ff()-----------------")
    ff()

    println("f2()-----------------")
    val f2 = fun()
    val fff = f2()
    println("fun()-----------------")

    val f4 = fun _
    println(f4()())

    println("fun()()-----------------")
    fun()()

    println("test()-----------------")
    test()
    println("-----------------")
/*
ff()-----------------
function....
f2()-----------------
function....
fun()-----------------
com.study.spark.scala.chapter05.Scala05_Function_Hell_5$$$Lambda$2/317574433@7e0babb1
fun()()-----------------
function....
test()-----------------
function....
-----------------
 */

  }

}
  